//
//  SCWishCommentViewModel.m
//  Mutal
//
//  Created by TonyStart on 16/10/24.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "SCWishCommentViewModel.h"
#import "SCNetworkTool.h"
#import "SCWishCommentModel.h"
@implementation SCWishCommentViewModel

-(void)requestWishCommentWithPostID:(NSString*)post_id finish:(void (^)(NSInteger))finish{
    
    NSDictionary *param = @{@"g":@"Appapi",@"m":@"comment",@"a":@"wish_comments",@"post_id":post_id};
    NSString *url = urlMakeWithDict(param);
    
    [[SCNetworkTool shared] requestDataWithMethod:GET url:url finish:^(id data, NSError *err,NSInteger code) {
        NSMutableArray *tempArray = [NSMutableArray array];
        for (NSDictionary *dict in data) {
            SCWishCommentModel *commentModel = [SCWishCommentModel wishCommentWithDict:dict];
            [tempArray addObject:commentModel];
        }
        self.wishComments = tempArray;
        finish(self.wishComments.count);
    }];
}
@end
